package com.mmlc.meimei.lichengkongjian.Adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.mmlc.meimei.lichengkongjian.App;
import com.mmlc.meimei.lichengkongjian.R;
import com.mmlc.network.responsebean.CategoryListResponseBean;

import java.util.List;

public class Classify_GrideViewAdapter extends BaseAdapter {

    ViewGroup viewGroup;
    List<CategoryListResponseBean.DataBean.ListBean> item;

    public Classify_GrideViewAdapter(ViewGroup viewGroup, List<CategoryListResponseBean.DataBean.ListBean> item) {
        this.viewGroup = viewGroup;
        this.item = item;
    }

    @Override
    public int getCount() {
        return item.size();
    }

    @Override
    public Object getItem(int i) {
        return item.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(final int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = App.layoutInflater.inflate(R.layout.adapter_classify_grideviewadapter, viewGroup, false);
        }
        TextView textView = (TextView) view.findViewById(R.id.tv_title);
        textView.setText(item.get(i).getName());
        return view;
    }
}

